package com.workManager.base;

import com.workManager.util.DateUtil;
import com.workManager.util.RedisUtil;
import org.springframework.stereotype.Service;

/**
 * Created by Thinkpad on 2017/1/12 0012.
 */
@Service
public class BaseServiceImpl implements  BaseService {

    public Long generateId() {
        return Long.parseLong(createId("PRIMARY_KEY"));
    }

    public  String createId(String key){
        String redisKey = "DATABASE_PUBLIC_"+key;
        String dateTime = DateUtil.getDateTime("yyMMddHHmmss");
        System.out.println("dateIime的值是------------------："+dateTime);
        return  dateTime + RedisUtil.incr(redisKey);
    }
}
